﻿package frEngine.animateControler
{
    import __AS3__.vec.*;
    import baseEngine.core.*;
    import baseEngine.modifiers.*;
    import baseEngine.system.*;
    import baseEngine.utils.*;
    import flash.display3D.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.utils.*;
    import frEngine.*;
    import frEngine.animateControler.keyframe.*;
    import frEngine.core.*;
    import frEngine.event.*;
    import frEngine.loaders.away3dMd5.*;
    import frEngine.shader.*;
    import frEngine.shader.filters.*;
    import frEngine.shader.filters.fragmentFilters.*;
    import frEngine.shader.filters.vertexFilters.*;
    import frEngine.shader.md5shader.*;
    import frEngine.shader.registType.*;

    public class Md5SkinAnimateControler extends MeshAnimateBase implements IRender
    {
        public var startIndex:Array;
        private var _enabledDraw:Boolean = true;
        public var triangleNum:Array;
        public var skinData:Vector.<Vector.<int>>;
        protected var attachObjectToBoneList:Dictionary;
        protected var attachObjectOffsetMatrix:Dictionary;
        protected var meshList:Dictionary;
        private var _mapBoneNameIndex:Dictionary;
        private var _tempMatrix3d:Matrix3D;
        private var _bonesRg:VcParam;
        protected var _updateAttachBone:Boolean = true;
        protected var _skeletoAnimator:SkeletonAnimator;
        protected var _skeleton:Skeleton;
        private var _matrix3d:Matrix3D;
        private var _worldView:Matrix3D;
        public var offsetPlayFrame:uint = 0;
        public static var Matrix3DDictionaryPool:Vector.<Vector.<Md5Matrix3D>> = new Vector.<Vector.<Md5Matrix3D>>;
        public static var defaultOffsetMatrix3d:Matrix3D = getDefaultMatrix3d();
        private static var _noTrackNameMatrix3d:Matrix3D;
        private static const _noTrackNameVectorList:Array = new Array();

        public function Md5SkinAnimateControler()
        {
            this.attachObjectToBoneList = new Dictionary(false);
            this.attachObjectOffsetMatrix = new Dictionary(false);
            this.meshList = new Dictionary(false);
            this._tempMatrix3d = new Matrix3D();
            this._matrix3d = Device3D.global;
            this._worldView = Device3D.worldView;
            return;
        }// end function

        public function get skeletoAnimator() : SkeletonAnimator
        {
            return this._skeletoAnimator;
        }// end function

        public function set skeletoAnimator(param1:SkeletonAnimator) : void
        {
            if (this._skeletoAnimator)
            {
                this._skeletoAnimator.dispose();
                FrEventDispatcher.instance.proxyRemoveEventListener(this._skeletoAnimator, Engine3dEventName.TRACK_PARSERCOMPLETE, this.track_ParsercompleteHander);
            }
            this._skeletoAnimator = param1;
            if (this._skeletoAnimator)
            {
                FrEventDispatcher.instance.proxyAddEventListener(this._skeletoAnimator, Engine3dEventName.TRACK_PARSERCOMPLETE, this.track_ParsercompleteHander);
            }
            return;
        }// end function

        public function getSwordLightSurface(param1:String, param2:int, param3:int, param4:int, param5:Vector3D) : SwordLightSurface
        {
            var _loc_6:* = this.getJointIndexFromName(param1);
            if (_loc_6 == -1 || !this._skeletoAnimator)
            {
                return null;
            }
            return this._skeletoAnimator.getSwordLightSurface(_loc_6, param2, param3, param4, param5);
        }// end function

        public function getJointIndexFromName(param1:String) : int
        {
            if (this._skeleton)
            {
                return this._skeleton.jointIndexFromName(param1);
            }
            return -1;
        }// end function

        public function getGJointPoseByName(param1:String) : Vector3D
        {
            var _loc_2:* = this.getJointIndexFromName(param1);
            if (_loc_2 == -1 || !this._skeletoAnimator)
            {
                return null;
            }
            return this._skeletoAnimator.getGJointPoseByIndex(_loc_2);
        }// end function

        public function get enabledDraw() : Boolean
        {
            return this._enabledDraw;
        }// end function

        public function set enabledDraw(param1:Boolean) : void
        {
            this._enabledDraw = param1;
            return;
        }// end function

        public function setCurActionFrame(param1:String, param2:int) : void
        {
            if (this._skeletoAnimator)
            {
                this._skeletoAnimator.play(param1, param2);
            }
            this._currentFrame = param2;
            return;
        }// end function

        override protected function updateCurFrame() : void
        {
            var _loc_3:Boolean = false;
            var _loc_1:* = targetMesh.timerContorler.curFrame - this.offsetPlayFrame;
            var _loc_2:* = cuPlayLable.length;
            if (_loc_1 >= _loc_2)
            {
                if (targetMesh.animationMode == PlayMode.ANIMATION_LOOP_MODE)
                {
                    _loc_1 = _loc_1 % _loc_2;
                }
                else
                {
                    _loc_1 = _loc_2 - 1;
                }
            }
            else if (_loc_1 < 0)
            {
                _loc_1 = 0;
            }
            this.currentFrame = cuPlayLable.from + _loc_1;
            return;
        }// end function

        override public function dispose(param1:Boolean = true) : void
        {
            this._bonesRg = null;
            cuPlayLable = null;
            curPlayTrackName = null;
            this.skeletoAnimator = null;
            this.skeleton = null;
            this.enabledDraw = true;
            this.offsetPlayFrame = 0;
            this.removeAllHang();
            super.dispose();
            return;
        }// end function

        public function removeAllHang() : void
        {
            var _loc_2:* = undefined;
            var _loc_1:* = new Array();
            for (_loc_2 in this.attachObjectToBoneList)
            {
                
                _loc_1.push(_loc_2);
            }
            for each (_loc_2 in _loc_1)
            {
                
                this.removeHang(_loc_2);
            }
            return;
        }// end function

        override public function get type() : int
        {
            return AnimateControlerType.Md5SkinAnimateControler;
        }// end function

        private function cloneFrom(param1:Md5SkinAnimateControler) : void
        {
            this.labels = param1.labels;
            targetMesh.bounds = param1.targetMesh.bounds;
            return;
        }// end function

        override protected function setSurfaceHander(event:Event) : void
        {
            super.setSurfaceHander(event);
            if (targetMesh.material.materialParams.vertexFilter)
            {
                if (Global3D.openSunLight)
                {
                    if (!targetMesh.material.materialParams.hasFilter(FilterType.VertexNormalFilter))
                    {
                        targetMesh.material.materialParams.addFilte(new VertexNormalFilter());
                    }
                    if (!targetMesh.material.materialParams.hasFilter(FilterType.LightFilter))
                    {
                        targetMesh.material.materialParams.addFilte(new LightFilter());
                    }
                }
            }
            return;
        }// end function

        private function track_ParsercompleteHander(event:ParamsEvent) : void
        {
            var _loc_2:* = event.params[0];
            FrEventDispatcher.instance.proxyDispatchEvent(this, Engine3dEventName.TRACK_PARSERCOMPLETE, [_loc_2]);
            return;
        }// end function

        public function addAnimateTracks(param1:SkeletonAnimator, param2:String) : void
        {
            this.skeletoAnimator = param1;
            if (param1 == null)
            {
                FrEventDispatcher.instance.proxyDispatchEvent(this, Engine3dEventName.InitComplete);
                return;
            }
            var _loc_3:String = "stand";
            var _loc_4:* = this._skeletoAnimator.animationSet;
            var _loc_5:* = _loc_4.animations;
            var _loc_6:int = 0;
            while (_loc_6 < _loc_5.length)
            {
                
                this.addLabel(_loc_5[_loc_6]);
                _loc_6++;
            }
            if (getLabel(curPlayTrackName))
            {
                _loc_3 = curPlayTrackName;
            }
            else if (param2)
            {
                _loc_3 = param2;
            }
            else if (!cuPlayLable)
            {
                _loc_3 = _loc_5[0].trackName;
            }
            else if (this.labels[cuPlayLable.trackName])
            {
                _loc_3 = cuPlayLable.trackName;
            }
            var _loc_7:* = this.setPlayLable(_loc_3);
            if (!_loc_7)
            {
                throw new Error("当前动作：" + _loc_3 + "不存在！");
            }
            return;
        }// end function

        public function removeHang(param1:Pivot3D) : void
        {
            delete this.attachObjectToBoneList[param1];
            delete this.attachObjectOffsetMatrix[param1];
            this.disposeMd5Matrix3D(this.meshList[param1]);
            delete this.meshList[param1];
            param1.identityOffsetTransform();
            param1.curHangControler = null;
            param1.parent = null;
            return;
        }// end function

        public function attachObjectToBone(param1:String, param2:Pivot3D, param3:Matrix3D = null) : void
        {
            if (param2.curHangControler && param2.curHangControler != this)
            {
                param2.curHangControler.removeHang(param2);
            }
            if (param2.parent != targetMesh && targetMesh)
            {
                targetMesh.addChild(param2);
            }
            this.attachObjectToBoneList[param2] = param1;
            if (param3 == null)
            {
                param3 = defaultOffsetMatrix3d.clone();
            }
            this.attachObjectOffsetMatrix[param2] = param3;
            param2.curHangControler = this;
            this.disposeMd5Matrix3D(this.meshList[param2]);
            delete this.meshList[param2];
            this._updateAttachBone = true;
            return;
        }// end function

        private function disposeMd5Matrix3D(param1:Vector.<Md5Matrix3D>) : void
        {
            var _loc_2:Md5Matrix3D = null;
            if (!param1)
            {
                return;
            }
            for each (_loc_2 in param1)
            {
                
                if (_loc_2)
                {
                    _loc_2.hasInit = false;
                }
            }
            Matrix3DDictionaryPool.push(param1);
            return;
        }// end function

        override public function setPlayLable(param1:Object, param2:Boolean = true) : Label3D
        {
            var _loc_5:Object = null;
            var _loc_3:* = super.setPlayLable(param1, false);
            var _loc_4:* = _loc_3 as SkeletonClipNode;
            for (_loc_5 in this.attachObjectToBoneList)
            {
                
                this.disposeMd5Matrix3D(this.meshList[_loc_5]);
                delete this.meshList[_loc_5];
            }
            if (_loc_4 && this._skeletoAnimator)
            {
                this._skeletoAnimator.play(_loc_4.trackName, this._currentFrame);
            }
            return _loc_4;
        }// end function

        private function autoPlaySeting() : void
        {
            var _loc_1:Label3D = null;
            if (this.autoPlay)
            {
                for each (_loc_1 in labels)
                {
                    
                    this.setPlayLable(_loc_1);
                    break;
                }
            }
            return;
        }// end function

        public function clear() : void
        {
            this.startIndex = null;
            this.triangleNum = null;
            this.skinData = null;
            this.offsetPlayFrame = 0;
            this._bonesRg = null;
            this.skeletoAnimator = null;
            this.skeleton = null;
            return;
        }// end function

        public function set skeleton(param1:Skeleton) : void
        {
            var _loc_2:SplitSurfaceInfo = null;
            if (this._skeleton)
            {
                delete this._skeleton.info.userList[this];
            }
            this._skeleton = param1;
            if (this._skeleton)
            {
                this._skeleton.info.userList[this] = true;
                _loc_2 = this._skeleton.splitSurfaceInfo;
                this.startIndex = _loc_2.startIndex;
                this.triangleNum = _loc_2.triangleNum;
                this.skinData = _loc_2.skinData;
                this.autoPlaySeting();
                this._updateAttachBone = true;
            }
            return;
        }// end function

        override public function toUpdateAnimate(param1:Boolean = false) : void
        {
            var _loc_2:Object = null;
            super.toUpdateAnimate(param1);
            if (this._skeletoAnimator)
            {
                if (this.changeFrame)
                {
                    this._skeletoAnimator.updateFrame(this._currentFrame);
                    for (_loc_2 in this.attachObjectToBoneList)
                    {
                        
                        this.updateupdatAnimatorHung(_loc_2);
                    }
                }
            }
            else if (this._updateAttachBone)
            {
                this._updateAttachBone = false;
                for (_loc_2 in this.attachObjectToBoneList)
                {
                    
                    this.updateupdatMeshHung(_loc_2);
                }
            }
            return;
        }// end function

        protected function updateupdatAnimatorHung(param1:Object) : void
        {
            var _loc_4:String = null;
            var _loc_5:int = 0;
            var _loc_6:Matrix3D = null;
            var _loc_7:Matrix3D = null;
            var _loc_8:Boolean = false;
            if (!this._skeletoAnimator)
            {
                return;
            }
            var _loc_2:* = this.meshList[param1];
            if (!_loc_2)
            {
                if (Matrix3DDictionaryPool.length > 0)
                {
                    _loc_2 = Matrix3DDictionaryPool.shift();
                }
                else
                {
                    _loc_2 = new Vector.<Md5Matrix3D>(30);
                }
                this.meshList[param1] = _loc_2;
            }
            if (this._currentFrame >= _loc_2.length)
            {
                _loc_2.length = this._currentFrame + 10;
            }
            var _loc_3:* = _loc_2[this._currentFrame];
            if (!_loc_3)
            {
                var _loc_9:* = new Md5Matrix3D();
                _loc_3 = new Md5Matrix3D();
                _loc_2[this._currentFrame] = _loc_9;
            }
            if (!_loc_3.hasInit)
            {
                _loc_4 = this.attachObjectToBoneList[param1];
                _loc_5 = this.getJointIndexFromName(_loc_4);
                if (_loc_5 != -1)
                {
                    _loc_7 = this.attachObjectOffsetMatrix[param1];
                    this._skeletoAnimator.getGMatrix3DByIndex(_loc_5, _loc_3);
                    _loc_8 = this._skeletoAnimator.getGMatrix3DByIndex(_loc_5, _loc_3);
                    if (_loc_8)
                    {
                        _loc_3.prepend(_loc_7);
                        _loc_3.hasInit = true;
                    }
                    else
                    {
                        _loc_6 = this._skeleton.getBaseGlobleBone(_loc_4);
                        _loc_3.copyFrom(_loc_6);
                        _loc_3.prepend(_loc_7);
                    }
                    param1.offsetTransform = _loc_3;
                }
                else
                {
                    param1.offsetTransform = null;
                }
            }
            else
            {
                param1.offsetTransform = _loc_3;
            }
            return;
        }// end function

        protected function updateupdatMeshHung(param1:Object) : void
        {
            var _loc_5:Matrix3D = null;
            if (!this._skeleton)
            {
                return;
            }
            var _loc_2:* = this.attachObjectToBoneList[param1];
            var _loc_3:* = this.attachObjectOffsetMatrix[param1];
            var _loc_4:* = this._skeleton.getBaseGlobleBone(_loc_2);
            if (_loc_4)
            {
                _loc_5 = new Matrix3D();
                _loc_5.copyFrom(_loc_4);
                _loc_5.prepend(_loc_3);
                param1.offsetTransform = _loc_5;
            }
            return;
        }// end function

        public function drawEdge(param1:Mesh3D, param2:Number = 1, param3:Number = 1, param4:Number = 1) : void
        {
            var _loc_6:EdgeSahder = null;
            var _loc_7:Boolean = false;
            if (!targetSurface || !this.startIndex)
            {
                return;
            }
            var _loc_5:* = targetMesh.material.materialParams.fragmentFilter;
            if (_loc_5 is TextureFilter)
            {
                _loc_6 = Md5MaterialManager.instance.getEdgeMaterial(targetMesh.material.materialParams.skinNum, param2, param3, param4, TextureFilter(_loc_5).texture);
                _loc_7 = _loc_6.hasPrepared(param1, targetSurface);
                if (_loc_7)
                {
                    this.drawImp(_loc_6.boneRg, _loc_6);
                }
            }
            return;
        }// end function

        public function drawShadow(param1:Mesh3D) : void
        {
            if (!targetSurface || !this.startIndex)
            {
                return;
            }
            var _loc_2:* = Md5MaterialManager.instance.getShadowMaterial(targetMesh.material.materialParams);
            var _loc_3:* = _loc_2.hasPrepared(param1, targetSurface);
            if (!_loc_3)
            {
                return;
            }
            if (param1.material.materialParams.enableMask)
            {
                Global3D.scene.context.setStencilReferenceValue(3);
                this.drawImp(_loc_2.boneRg, _loc_2);
            }
            else
            {
                Global3D.scene.context.setStencilReferenceValue(2);
                this.drawImp(_loc_2.boneRg, _loc_2);
            }
            return;
        }// end function

        public function drawDepth(param1:Mesh3D, param2:Number = 1, param3:Number = 1, param4:Number = 1, param5:Number = 1) : void
        {
            if (!targetSurface || !this.startIndex)
            {
                return;
            }
            var _loc_6:* = Md5MaterialManager.instance.getDepthMaterial(targetMesh.material.materialParams.skinNum, param2, param3, param4, param5);
            var _loc_7:* = _loc_6.hasPrepared(param1, targetSurface);
            if (!_loc_7)
            {
                return;
            }
            this.drawImp(_loc_6.boneRg, _loc_6);
            return;
        }// end function

        private function drawXray(param1:Mesh3D) : void
        {
            var _loc_2:* = Md5MaterialManager.instance.getXRayMaterial(targetMesh.material.materialParams.skinNum);
            var _loc_3:* = _loc_2.hasPrepared(param1, targetSurface);
            if (!_loc_3)
            {
                return;
            }
            Global3D.scene.context.setStencilActions(Context3DTriangleFace.FRONT_AND_BACK, Context3DCompareMode.LESS, Context3DStencilAction.KEEP);
            this.drawImp(_loc_2.boneRg, _loc_2);
            Global3D.scene.context.setStencilActions(Context3DTriangleFace.FRONT_AND_BACK, Context3DCompareMode.GREATER_EQUAL, Context3DStencilAction.KEEP);
            return;
        }// end function

        private function drawOutLighting(param1:Mesh3D, param2:Vector3D, param3:Number, param4:Number, param5:FragmentFilter, param6:Boolean) : void
        {
            var _loc_7:OutLightingShader = null;
            var _loc_8:Boolean = false;
            if (param5 is TextureFilter)
            {
                _loc_7 = Md5MaterialManager.instance.getOutLightingMaterial(3, param2.x, param2.y, param2.z, param4, TextureFilter(param5).texture, param3);
                _loc_8 = _loc_7.hasPrepared(param1, targetSurface);
                if (_loc_8)
                {
                    this.drawImp(_loc_7.boneRg, _loc_7);
                }
            }
            return;
        }// end function

        public function draw(param1:Mesh3D, param2:ShaderBase = null) : void
        {
            var _loc_7:Number = NaN;
            if (!targetSurface || !targetMesh.material || !this.startIndex)
            {
                return;
            }
            var _loc_3:* = targetMesh.material.materialParams.needRebuild;
            var _loc_4:* = targetMesh.material.materialParams.needRegetBone;
            var _loc_5:* = targetMesh.material.hasPrepared(param1, targetSurface);
            if (!this._bonesRg || _loc_3 || _loc_4)
            {
                this._bonesRg = targetMesh.material.getParam("{bones}", true);
                targetMesh.material.materialParams.needRegetBone = false;
            }
            if (!_loc_5)
            {
                return;
            }
            var _loc_6:* = targetMesh.material.materialParams;
            this._worldView.copyFrom(targetMesh.world);
            this._worldView.append(Device3D.view);
            if (_loc_6.enableMask)
            {
                Global3D.scene.context.setStencilReferenceValue(0);
                if (_loc_6.enableOutLight)
                {
                    this.drawOutLighting(param1, _loc_6.outLightColor, _loc_6.outLightStrength, _loc_6.alphaBaseValue, _loc_6.fragmentFilter, _loc_6.isOpenHerizionKil);
                }
                this.drawImp(this._bonesRg, targetMesh.material);
                if (_loc_6.enableXray)
                {
                    this.drawXray(param1);
                }
                Global3D.scene.context.setStencilReferenceValue(1);
            }
            else
            {
                _loc_7 = _loc_6.colorOffsetValue[3];
                if (_loc_6.enableOutLight)
                {
                    if (_loc_6.outLightAsBgColor)
                    {
                        this.drawOutLighting(param1, _loc_6.outLightColor, _loc_6.outLightStrength, _loc_7, _loc_6.fragmentFilter, _loc_6.isOpenHerizionKil);
                        this.drawImp(this._bonesRg, targetMesh.material);
                    }
                    else if (_loc_7 < 1 || _loc_6.blendMode != EBlendType.BLEND_NONE)
                    {
                        Global3D.scene.context.setStencilReferenceValue(1);
                        Global3D.scene.context.setStencilActions(Context3DTriangleFace.FRONT_AND_BACK, Context3DCompareMode.NOT_EQUAL, Context3DStencilAction.SET, Context3DStencilAction.KEEP, Context3DStencilAction.KEEP);
                        _loc_6.colorOffsetValue[3] = 0;
                        this.drawImp(this._bonesRg, targetMesh.material);
                        Global3D.scene.context.setStencilActions(Context3DTriangleFace.FRONT_AND_BACK, Context3DCompareMode.GREATER);
                        this.drawOutLighting(param1, _loc_6.outLightColor, _loc_6.outLightStrength, _loc_7, _loc_6.fragmentFilter, _loc_6.isOpenHerizionKil);
                        Global3D.scene.context.setStencilActions();
                        _loc_6.colorOffsetValue[3] = _loc_7;
                        this.drawImp(this._bonesRg, targetMesh.material);
                    }
                    else
                    {
                        this.drawOutLighting(param1, _loc_6.outLightColor, _loc_6.outLightStrength, 1, _loc_6.fragmentFilter, _loc_6.isOpenHerizionKil);
                        this.drawImp(this._bonesRg, targetMesh.material);
                    }
                }
                else if (_loc_7 < 1)
                {
                    _loc_6.colorOffsetValue[3] = 0;
                    this.drawImp(this._bonesRg, targetMesh.material);
                    _loc_6.colorOffsetValue[3] = _loc_7;
                    this.drawImp(this._bonesRg, targetMesh.material);
                }
                else
                {
                    this.drawImp(this._bonesRg, targetMesh.material);
                }
            }
            return;
        }// end function

        private function drawImp(param1:VcParam, param2:ShaderBase) : void
        {
            var _loc_3:Vector.<Number> = null;
            var _loc_7:String = null;
            var _loc_8:Dictionary = null;
            var _loc_9:int = 0;
            if (!param1 || !this.enabledDraw)
            {
                return;
            }
            this._matrix3d.copyFrom(targetMesh.world);
            var _loc_4:* = this.startIndex.length;
            var _loc_5:int = 0;
            var _loc_6:* = param2.materialParams;
            if (this._skeletoAnimator && this._skeletoAnimator.curActionTrack && this._skeletoAnimator.curActionTrack.hasLoaded)
            {
                _loc_7 = this._skeletoAnimator.curActionTrack.trackName;
                _loc_8 = this._skeleton.getFrameList(this._skeletoAnimator.fileName, _loc_7, _loc_4);
                _loc_9 = this._currentFrame;
                _loc_5 = 0;
                while (_loc_5 < _loc_4)
                {
                    
                    _loc_3 = _loc_8[_loc_5][_loc_9];
                    if (!_loc_3)
                    {
                        _loc_3 = this._skeletoAnimator.getGlobalMatrices(_loc_7, _loc_9, this.skinData[_loc_5], this._skeleton);
                        _loc_8[_loc_5][_loc_9] = _loc_3;
                    }
                    param1.value = _loc_3;
                    param2.draw(targetMesh, targetSurface, _loc_6.depthCompare, _loc_6.cullFace, _loc_6.depthWrite, _loc_6.sourceFactor, _loc_6.destFactor, this.startIndex[_loc_5], this.triangleNum[_loc_5]);
                    _loc_5++;
                }
            }
            else
            {
                _loc_5 = 0;
                while (_loc_5 < _loc_4)
                {
                    
                    _loc_3 = _noTrackNameVectorList[_loc_5];
                    if (!_loc_3)
                    {
                        _loc_3 = getNoTrack(_loc_5);
                        _noTrackNameVectorList[_loc_5] = _loc_3;
                    }
                    param1.value = _loc_3;
                    param2.draw(targetMesh, targetSurface, _loc_6.depthCompare, _loc_6.cullFace, _loc_6.depthWrite, _loc_6.sourceFactor, _loc_6.destFactor, this.startIndex[_loc_5], this.triangleNum[_loc_5]);
                    _loc_5++;
                }
            }
            var _loc_10:* = Global3D;
            var _loc_11:* = Global3D.objectsDrawn + 1;
            _loc_10.objectsDrawn = _loc_11;
            return;
        }// end function

        public function getMeshHangBoneName(param1:Pivot3D) : String
        {
            return this.attachObjectToBoneList[param1];
        }// end function

        public function get skeleton() : Skeleton
        {
            return this._skeleton;
        }// end function

        private static function getDefaultMatrix3d() : Matrix3D
        {
            var _loc_1:* = new Matrix3D();
            _loc_1.appendRotation(180, Vector3D.Y_AXIS);
            _loc_1.appendRotation(90, Vector3D.X_AXIS);
            return _loc_1;
        }// end function

        private static function getNoTrack(param1:uint) : Vector.<Number>
        {
            if (!_noTrackNameMatrix3d)
            {
                _noTrackNameMatrix3d = new Matrix3D();
                _noTrackNameMatrix3d.appendRotation(180, Vector3D.Y_AXIS);
            }
            var _loc_2:* = new Vector.<Number>;
            var _loc_3:int = 0;
            var _loc_4:* = Device3D.maxBonesPerSurface;
            while (_loc_3 < _loc_4)
            {
                
                _noTrackNameMatrix3d.copyRawDataTo(_loc_2, _loc_3 * 12, true);
                _loc_3++;
            }
            return _loc_2;
        }// end function

    }
}
